package backserver;

/**
 * Created by Administrator on 2016/1/8.
 */
public class BackServer {
    public static BackTask task;
    public synchronized static void start(){
        if(task==null||task.state==0){
            System.out.println("启动后台服务");
            task=new BackTask();
            task.state=1;
            Thread thread=new Thread(task);
            thread.start();
        }
    }

    public synchronized static void stop(){
        if(task!=null&&task.state==1){
            System.out.println("结束后台服务");
            task.state=0;
        }
    }
}

